package cn.com.cym.gamezao.repository.authorize;

import cn.com.cym.gamezao.base.BaseRepository;
import cn.com.cym.gamezao.entity.authorize.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@RedisHash
@Repository
public interface UserRepository extends BaseRepository<User,Long> {

    @Query("from User where deleted=:deleted")
    List<User> findAllByDeleted(@Param("deleted") Boolean deleted);

    @Query("from User where userName=:userName and password=:password")
    @Deprecated
    List<User> login(@Param("userName") String userName,@Param("password") String password);

    @Query("from User where userName=:userName")
    List<User> fetchByUserName(@Param("userName") String userName);

    User getUserByUserName(String userName);
}
